<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html >
<html>
<head>
<meta name="Generator" content="TPshop1.2" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title><?php echo ($tpshop_config['shop_info_store_title']); ?></title>
<meta http-equiv="keywords" content="<?php echo ($tpshop_config['shop_info_store_keyword']); ?>" />
<meta name="description" content="<?php echo ($tpshop_config['shop_info_store_desc']); ?>" />

<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/><link rel="stylesheet" href="/Template/mobile/new/Static/css/iconfont/iconfont.css">
<?php if($is_ios != ''): ?><div style="margin:0 auto;padding:4px 0;width:100%;background: #3cca36; color:#fff;">
        <?php if($_GET[act] != 1): ?><a href="javascript:history.go(-1)" style="font-size:14px;color:#fff;"><img src="/Template/mobile/new/Static/images/back.png" style="vertical-align: middle;" width="16"   />返回 </a><?php endif; ?>
        <div style="float:right;font-size:12px;margin-right:5px;"><a href="<?php echo U('Mobile/Index/index');?>" style="color:#fff;"><i class="icon iconfont icon-shouye" style="margin-right:4px;"></i>首页</a></div>
    </div><?php endif; ?>
<link rel="stylesheet" type="text/css" href="/Template/mobile/new/Static/css/public.css"/>
<link rel="stylesheet" type="text/css" href="/Template/mobile/new/Static/css/login.css"/>  
<script type="text/javascript" src="/Template/mobile/new/Static/js/jquery.js"></script>
<script src="/Public/js/global.js"></script>
<script src="/Public/js/mobile_common.js"></script>
<script type="text/javascript" src="/Template/mobile/new/Static/js/layer.js" ></script>
</head>
<body>
  	<div class="denglu">
		<form action="" method="post">        	
            <div class="Login">
				<dl>
	            <dt>用户名：</dt>
			    	<dd><input type="text" name="username" id="username" placeholder="请输入邮箱/手机号" value="" /></dd>
				</dl>
                <dl style=" margin-top:15px;">
                <dt>密码：</dt>
					<dd><input type="password" name="password" id="password" placeholder="密码"/></dd>
	            </dl>
				<div class="field submit-btn">
					<input type="button" class="btn_big1" onClick="checkSubmit()" value="登 录" />
					<input type="hidden" name="referurl" id="referurl" value="<?php echo ($referurl); ?>">
				</div>
            <div class="ng-foot">
              <div class="ng-cookie-area" >
                <label class="bf1 login_ffri">
					<input type="checkbox" name="remember" value="1" checked=""> &nbsp;自动登录 
				</label>
              </div>
              <div class="ng-link-area" >
                <span style=" margin-right:5px; border-right:1px solid #eeeeee">
                  <a href="<?php echo U('User/reg');?>" >免费注册</a>
                </span>
                 <span class="user_line"></span>
                   <span >
                  <a href="<?php echo U('User/forget_pwd');?>" >忘记密码？</a>
                </span>
              </div>
            
            </div>			
          </div>
		</form>
	</div>
<script type="text/javascript">

function checkSubmit()
{

	var username = $.trim($('#username').val());
	var password = $.trim($('#password').val());
	var referurl = $('#referurl').val();
	if(username == ''){
		showErrorMsg('用户名不能为空!');
		return false;
	}
//	if(!checkMobile(username) && !checkEmail(username)){
//		showErrorMsg('账号格式不匹配!');
//		return false;
//	}
	if(password == ''){
		showErrorMsg('密码不能为空!');
		return false;
	}
	
	if($.trim($('#verify_code').val()) == ''){
		//showErrorMsg('验证码不能为空!');
		//return false;
	}	
	//$('#login-form').submit();
	$.ajax({
		type : 'post',
		url : '/index.php?m=Mobile&c=User&a=do_login&t='+Math.random(),
		data : {username:username,password:password,referurl:referurl},		
		dataType : 'json',
		success : function(res){
			if(res.status == 1){
				top.location.href = res.url;
			}else{
				showErrorMsg(res.msg);
			}
		},
		error : function(XMLHttpRequest, textStatus, errorThrown) {
			showErrorMsg('网络失败，请刷新页面后重试');
		}
	})
}


    function checkMobile(tel) {
        var reg = /(^1[3|4|5|7|8][0-9]{9}$)/;
        if (reg.test(tel)) {
            return true;
        }else{
            return false;
        };
    }
    
    function checkEmail(str){
        var reg = /^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
        if(reg.test(str)){
            return true;
        }else{
            return false;
        }
    }
    
    function showErrorMsg(msg){
    	//$('.msg-err').show();
    	//$('.J-errorMsg').html(msg);
    	layer.open({content:msg,time:2});
    }
    
    function verify(){
        $('#verify_code_img').attr('src','/index.php?m=Home&c=User&a=verify&r='+Math.random());
     }

</script>	

<div class="v_nav">
	<div class="vf_nav">
		<ul>

			<li> <a href="<?php echo U('Mobile/Index/index');?>" <?php if($navid == 'home'): ?>class="act"<?php endif; ?> >
			    <i class="icon iconfont icon-shouye"></i>
			    <span>首页</span></a></li>

           	<?php if($_SESSION[is_coach]!=1){ ?>
                <li><a href="<?php echo U('Goods/categoryList');?>" <?php if($navid == 'shop'): ?>class="act"<?php endif; ?> >
                    <i class="icon iconfont icon-paobu fontbao"></i>
                    <span>商城</span></a></li>
                    
                <li><a href="<?php echo U('Coach/coach_list');?>" <?php if($navid == 'coach'): ?>class="act"<?php endif; ?> >
                    <i class="icon iconfont icon-juzhong"></i>
                    <span>教练</span></a></li>
                <li><a href="<?php echo U('Cart/cart');?>" <?php if($navid == 'cart'): ?>class="act"<?php endif; ?> >
                    <i class="icon iconfont icon-gouwuche fontshop"></i>
                    <span>购物车</span></a></li>
            <?php } ?>
           
			<!--<li>-->
			<!--<a href="<?php echo U('Cart/cart');?>">-->
			   <!--<em class="global-nav__nav-shop-cart-num" id="cart_quantity" style="right:9px;"></em>-->
			   <!--<i class="vf_4"></i>-->
			   <!--<span>购物车</span>-->
			   <!--</a>-->
			<!--</li>-->
			<?php if($_SESSION['is_coach']){ ?>
			<li><a href="<?php echo U('Yuyue/coach_detail');?>" <?php if($navid == 'yuyue'): ?>class="act"<?php endif; ?> >
			    <i class="icon iconfont icon-calendar"></i>
				<span>预约</span></a>
			</li>
			<?php }else{ ?>
			<li style="display:none;"><a href="<?php echo U('Yuyue/coach_list');?>" <?php if($navid == 'yuyue'): ?>class="act"<?php endif; ?>  >
			    <i class="icon iconfont icon-calendar"></i>
				<span>预约</span></a>
			</li>
			<?php } ?>


			<!--<li><a href="<?php echo U('Yuyue/coach_list');?>">-->
				<!--<i class="vf_5"></i>-->
				<!--<span>预约</span></a>-->
			<!--</li>-->
			<li><a href="<?php echo U('User/index');?>" <?php if($navid == 'user'): ?>class="act"<?php endif; ?>>
			    <i class="icon iconfont icon-gerenzhongxin"></i>
			    <span>我的</span></a>
			</li>
		</ul>
	</div>
</div> 
<script type="text/javascript">
$(document).ready(function(){
	  var cart_cn = getCookie('cn');
	  if(cart_cn == ''){
		$.ajax({
			type : "GET",
			url:"/index.php?m=Home&c=Cart&a=header_cart_list",//+tab,
			success: function(data){								 
				cart_cn = getCookie('cn');
				$('#cart_quantity').html(cart_cn);						
			}
		});	
	  }
	  $('#cart_quantity').html(cart_cn);
});
</script>

<?php if($_GET[act] == 1): ?><script>
    XBack = {};

    (function(XBack) {
        XBack.STATE = 'x - back';
        XBack.element;

        XBack.onPopState = function(event) {
            event.state === XBack.STATE && XBack.fire();
            XBack.record(XBack.STATE); //初始化事件时，push一下
        };

        XBack.record = function(state) {
            history.pushState(state, null, location.href);
        };

        XBack.fire = function() {
            var event = document.createEvent('Events');
            event.initEvent(XBack.STATE, false, false);
            XBack.element.dispatchEvent(event);
        };

        XBack.listen = function(listener) {
            XBack.element.addEventListener(XBack.STATE, listener, false);
        };

        XBack.init = function() {
            XBack.element = document.createElement('span');
            window.addEventListener('popstate', XBack.onPopState);
            XBack.record(XBack.STATE);
        };

    })(XBack); // 引入这段js文件

    XBack.init();
    XBack.listen(function() {});
</script><?php endif; ?>
<!-- 微信浏览器 调用微信 分享js-->
<?php if($signPackage != null): endif; ?>
<!-- 微信浏览器 调用微信 分享js  end-->
</body>
</html>